document.querySelectorAll('.product-card').forEach(card => {
    card.addEventListener('click', () => {
      showProductModal({
        title: card.querySelector('.product-title').textContent,
        image: card.querySelector('.product-img').src,
        price: card.querySelector('.product-price').textContent
      });
    });
  });
  const searchInput = document.querySelector('.search-input');
searchInput.addEventListener('input', debounce(function(e) {
  fetch(`/api/search?q=${e.target.value}`)
    .then(res => res.json())
    .then(showSearchSuggestions);
}, 300));